package com.exartisan.thanhdoanhn;

import java.util.ArrayList;

import com.exartisan.adapter.ForumDetailAdapter;
import com.exartisan.bean.FbComment;
import com.exartisan.bean.FbUser;
import com.exartisan.bean.Post;

import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.Toast;


public class ForumDetailActivity extends BaseActivity {
	
	private ForumDetailAdapter mAdapter;
	private ListView listView;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);	
	}
	
	@Override
	protected void initUI() {
		setContentView(R.layout.detail_forum);
		listView = (ListView) findViewById(R.id.lv_detail4rum);
	
	}

	@Override
	protected void initProcess() {
		
		Post post = new Post(1, 1, 1, "abcdef", "wtf", "22/09/2013", "vai nham", "haivl", "http://tai-facebook.net/wp-content/uploads/2013/02/avatar-facebook.jpg", "http://tai-facebook.net/wp-content/uploads/2013/02/avatar-facebook.jpg");
		ArrayList<FbComment> fbComments = new ArrayList<FbComment>();
		/*for (int i = 0; i < 10; i++) {
			FbUser fbUser = new FbUser();
			fbUser.setId("123");
			fbUser.setName("Haivl");
			FbComment fbComment = new FbComment("1", "hello world!", "22/09/2013", fbUser, 3);
			fbComments.add(fbComment);
		}*/

		//	ko co webview
		mAdapter = new ForumDetailAdapter(this, ForumDetailActivity.post, fbComments, false, null);
		//co webview
//		mAdapter = new ForumDetailAdapter(this, post, fbComments, true, "http://www.thanhdoanhanoi.gov.vn/cham-soc-thieu-nhi-nhi-dong/chi-tiet-%E2%80%9Cdem-hoi-trang-ram%E2%80%9D-tet-trung-thu-nam-2013.html");
		listView.setAdapter(mAdapter);
		listView.setOnItemClickListener( new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
					long arg3) {
				Toast.makeText(getApplicationContext(), "position: "+arg2, Toast.LENGTH_SHORT).show();
			}
		});
	}
	
	

}
